﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;

namespace ArgusLib.Controls
{
	public class StatusLabel : Label
	{
		string text;
		string title;
		string separator;

		public StatusLabel()
			: base()
		{
			this.StatusTitle = "StatusLabel";
			this.Separator = ": ";
		}

		[Category("Appearance")]
		[Editor(typeof(MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
		[Localizable(true)]
		public string StatusTitle
		{
			get { return this.title; }
			set
			{
				this.title = value;
				this.UpdateText();
			}
		}

		[Category("Appearance")]
		[Editor(typeof(MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
		[Localizable(true)]
		public string StatusText
		{
			get { return this.text; }
			set
			{
				this.text = value;
				this.UpdateText();
			}
		}

		[Category("Appearance")]
		[Editor(typeof(MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
		[Localizable(true)]
		public string Separator
		{
			get { return this.separator; }
			set
			{
				this.separator = value;
				this.UpdateText();
			}
		}

		private void UpdateText()
		{
			base.Text = this.StatusTitle + this.Separator + this.StatusText;
		}

		[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
		[Localizable(false)]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public override string Text
		{
			get { return base.Text; }
			set
			{
				if (this.DesignMode == false)
					throw new NotSupportedException();
			}
		}
	}
}
